﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace _1065010_1065053_1065059_1065064
{
    class DataProvider
    {
        public static SqlConnection ConnectionData()
        {
            string chuoikn = "Data Source=.;Initial Catalog=QuanLySieuThy;Integrated Security=True";
            SqlConnection kn = new SqlConnection();
            kn.ConnectionString = chuoikn;
            kn.Open();
            return kn;
        }
        public static DataTable LoadGridView(string sql)
        {
            SqlConnection kn = DataProvider.ConnectionData();
            DataTable bang = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(sql, kn);
            da.Fill(bang);
            return bang;
        }

        public static DataTable HienThiDanhSach(string sql)
        {
            SqlConnection kn = DataProvider.ConnectionData();
           
            return  DataProvider.LoadGridView(sql);
        }

    }
}
